package com.classic.utils;

import android.content.Context;
import android.content.Intent;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;

import com.classic.duanzhi.EpisodeListActivity;
import com.classic.duanzhi.R;
import com.classic.duanzhi.UNewsActivity;


public class ShowADViewLeft extends LinearLayout {
    public ShowADViewLeft(Context context) {
        super(context);
        initView(context, null);
    }

    public ShowADViewLeft(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        initView(context, attrs);
    }

    public ShowADViewLeft(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        initView(context, attrs);
    }


    private void initView(final Context context, AttributeSet o) {
        LayoutInflater.from(context).inflate(R.layout.u_ad_view_left, this);
        findViewById(R.id.ll_right).setVisibility(ADUtils.getInstance().getSwitch() ? VISIBLE : GONE);
        findViewById(R.id.ll_xiaohua_1).setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                context.startActivity(new Intent(context, EpisodeListActivity.class));
            }
        });
        findViewById(R.id.ll_xinwen_1).setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                context.startActivity(new Intent(context, UNewsActivity.class));
            }
        });
    }


}
